//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web;

namespace CommunityServer.Components
{
	/// <summary>
	/// Summary description for Redirect.
	/// </summary>
	public class Redirect : IHttpHandler
	{
		public Redirect()
		{
			//
			// TODO: Add constructor logic here
			//
		}

	    public void ProcessRequest(HttpContext context)
	    {
	        string url = context.Request.QueryString["u"];
            if(!Globals.IsNullorEmpty(url))
            {
                context.Response.Redirect(url);
                
            }
            else
            {
                context.Response.Redirect(Globals.GetSiteUrls().Home);
            }

            context.Response.End();
	    }

	    public bool IsReusable
	    {
	        get { return false; }
	    }
	}
}
